package icu.zlz.emqx.domain;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import icu.zlz.common.core.annotation.Excel;
import icu.zlz.common.core.web.domain.BaseEntity;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 设备组对象 iot_group
 *
 * @author zangs
 * @since 2024-12-27
 */
public class IotGroup extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 自定义参数 0 全部(只有管理员可以选)  1自己加入的 2 自己创建的  3 己加入的和自己创建的
     */
    private Integer type;
    /**
     * 自定义参数  用户Id
     */
    private Long userId;
    /**
     * 该用户是否为管理员
     */
    private boolean isAdmin;

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public boolean isAdmin() {
        return isAdmin;
    }

    public void setAdmin(boolean admin) {
        isAdmin = admin;
    }

    /**
     * 设备组ID
     */
    private Long groupId;


    @Excel(name = "该用户权限")
    private String permissions;


    /**
     * 主题前缀
     */
    @Pattern(regexp ="^[a-zA-Z][a-zA-Z0-9_]*$",message = "设备组名格式不正确，必须以字母开头，允许输入字母、数字和下划线")
    @NotNull(message = "主题前缀不能为空")
    @Excel(name = "主题前缀")
    private String groupPrefix;

    /**
     * mqtt用户名
     */
    @NotNull(message = "mqtt用户名不能为空")

    @Excel(name = "mqtt用户名")
    private String secretKey;

    /**
     * mqtt密码
     */
    @NotNull(message = "mqtt密码不能为空")

    @Excel(name = "mqtt密码")
    private String secretValue;

    /**
     * 此群管理者id
     */
    @Excel(name = "此群管理者id")
    private Long adminUserId;

    /**
     * 0正常，1停用
     */
    @NotNull(message = "状态不能为空")

    @Excel(name = "状态 0正常，1停用")
    private String status;

    /**
     * 设备组名
     */
    @NotNull(message = "设备组名不能为空")
    @Excel(name = "设备组名")
    private String groupName;

    /**
     * 设备组名
     */
    @Excel(name = "uid")
    private String uid;

    public void setGroupId(Long groupId) {
        this.groupId = groupId;
    }

    public Long getGroupId() {
        return groupId;
    }

    public void setGroupPrefix(String groupPrefix) {
        this.groupPrefix = groupPrefix;
    }

    public String getGroupPrefix() {
        return groupPrefix;
    }

    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }

    public String getSecretKey() {
        return secretKey;
    }

    public void setSecretValue(String secretValue) {
        this.secretValue = secretValue;
    }

    public String getSecretValue() {
        return secretValue;
    }

    public void setAdminUserId(Long adminUserId) {
        this.adminUserId = adminUserId;
    }

    public Long getAdminUserId() {
        return adminUserId;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getStatus() {
        return status;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public String getGroupName() {
        return groupName;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("groupId", getGroupId())
                .append("groupPrefix", getGroupPrefix())
                .append("secretKey", getSecretKey())
                .append("secretValue", getSecretValue())
                .append("adminUserId", getAdminUserId())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .append("status", getStatus())
                .append("groupName", getGroupName())
                .append("uid", getUid())
                .toString();
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getPermissions() {
        return permissions;
    }

    public void setPermissions(String permissions) {
        this.permissions = permissions;
    }
}
